/*
package org.itboys.mobile.service.mongo.front;

import org.itboys.commons.utils.tools.LongUtil;
import org.itboys.framework.resource.ResourceHolder;
import org.itboys.mobile.common.SundayCommonConstants;
import org.itboys.mobile.dao.product.SundayProductMapper;
import org.itboys.mobile.dto.SundayCommunityDynamicProductDto;
import org.itboys.mobile.entity.mongo.SundayCommunityDynamicProduct;
import org.itboys.mobile.entity.mysql.product.SundayProduct;
import org.itboys.mongodb.core.MongoDataSource;
import org.itboys.mongodb.service.BaseMongoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

*/
/**
 * Created by zhangyang on 2018/2/3.
 * 圣代_社区动态_商品_service
 *//*

@Service
public class SundayFrontCommunityDynamicProductService extends BaseMongoService<SundayCommunityDynamicProduct>{


    @Resource(name = "mobileDs")
    private MongoDataSource sundayDataSource;
    @Override
    protected MongoDataSource getMongoDataSource() {
        return sundayDataSource;
    }

    @Override
    protected Class<SundayCommunityDynamicProduct> getEntityClass() {
        return SundayCommunityDynamicProduct.class;
    }

    @Autowired
    private SundayProductMapper productMapper;
    @Autowired
    private ResourceHolder resourceHolder;

    */
/**
     * 根据动态id获取其商品dto
     * @param mainId    动态id集合
     * @return  dtoList
     *//*

    public List<SundayCommunityDynamicProductDto> selectProductDto(List<Long> mainId){
        Map<String,Object> param = new HashMap<String,Object>();
        param.put("isDeleted", SundayCommonConstants.NO);
        param.put("mainId in",mainId);
        List<SundayCommunityDynamicProduct> dynamicProductList = super.list(param);
        List<SundayCommunityDynamicProductDto> dynamicProductDtoList = new ArrayList<SundayCommunityDynamicProductDto>();

        List<Long> productIdList = new ArrayList<Long>();
        for(SundayCommunityDynamicProduct dynamicProduct : dynamicProductList){
            productIdList.add(dynamicProduct.getProductId());
        }

        param.clear();
        param.put("ids",productIdList);
        List<SundayProduct> productList = productMapper.select(param);

        //组装dto
        String imgRoot = resourceHolder.getStringValue("imgRoot");
        for(SundayProduct product : productList){
            for(SundayCommunityDynamicProduct dynamicProduct : dynamicProductList){
                if(LongUtil.isNotZreo(dynamicProduct.getProductId()) && dynamicProduct.getProductId().longValue() == product.getId().longValue()){
                    SundayCommunityDynamicProductDto dynamicProductDto = new SundayCommunityDynamicProductDto(dynamicProduct.getMainId(),product.getId(),product.getName(),imgRoot+product.getImage(),product.getPrice());
                    dynamicProductDtoList.add(dynamicProductDto);
                }
            }
        }

        return dynamicProductDtoList;
    }
}
*/
